package ac.neec.mio.resting;

import java.util.ArrayList;
import java.util.List;

import ac.neec.mio.ui.fragment.RestingDialogFragment;
import ac.neec.timewatch.TimeWatchInterface;
import android.app.FragmentManager;
import android.util.Log;


/**
 * Created by G011C1093 on 14/01/18.
 */
public class RestingMeasurementManager implements TimeWatchInterface {

    public static final long RESTING_MEASUREMENT_TIME = 60000;
    public static final int TIMER_RUNNING = 1;
    public static final int TIMER_STOP = 2;
    public static final String DECIMAL_POINT = ".";
    public static int mRestingHeartRate = -1;

    private TimeWatchInterface fragment;
    private RestingDialogFragment restingDialogFragment;
    private static List<TimeWatchInterface> list = new ArrayList<TimeWatchInterface>();

    public static void setObserver(TimeWatchInterface obj){
    	list.add(obj);
    }

    public RestingMeasurementManager(TimeWatchInterface fragment) {
        list.add(fragment);
        setRestingDialogFragment();
    }

    private void setRestingDialogFragment() {
    	restingDialogFragment = new RestingDialogFragment(list);
        restingDialogFragment.setRetingDialogListener(this);
    }

    public void showRestingDialog(FragmentManager manager) {
        restingDialogFragment.show(manager, null);
    }

    @Override
    public void notifyTimerUpdata(long time) {
    }

    @Override
    public void onCancel() {
        Log.e("", "ManagerOnCancel!!!");
    }

    @Override
    public void onAlarm() {
        Log.e("", "ManagerOnAlarm!!!");
    }
}
